<script setup lang="ts">
import { ref } from "vue";

const money = ref(9999999999);

const handler = ($parent) => {
  const amout: number = parseInt((Math.random() * 1000).toFixed(0), 10);
  money.value += amout;
  $parent.money -= amout;
};
</script>

<template>
  <div class="daughter">
    <h2>我是女儿组件曹节 {{ money }}</h2>
    <button @click="handler($parent)">找老爸要钱</button>
  </div>
</template>

<style scoped>
.daughter {
  width: 400px;
  height: 290px;
  background: pink;
  padding: 0.5rem;
}
</style>
